package org.davidliebman.android.awesomecube;


import android.util.Log;
import android.content.*;

public class SimpleCorner extends Mesh {
	
//	int mFace1;
//	int mFace2;
//	int mFace3;
	
	public SimpleCorner(Context c) {
		super(c);
		mContext = c;
		this.settupArrays();
		this.preBuildMesh();
	} 
	
	public SimpleCorner(Context c, int face1, int face2, int face3) {
		super(c);
		mContext = c;
		mFace1 = face1;
		mFace2 = face2;
		mFace3 = face3;
		this.settupArrays();

		this.preBuildMesh();
	}
	
	public SimpleCorner(Context c, Positioning mP, int face1, int face2, int face3) {
		super(c);
		mContext = c;
		mFace1 = face1;
		mFace2 = face2;
		mFace3 = face3;
		mP1 = mP;//mP1
		this.settupArrays();

		this.preBuildMesh();
		//this.addToMP0(mP);
	}
	

	
	@Override
	public void settupArrays() {
	
		if ( ! this.mShouldLoadArrays) return;
	
		
		this.mShouldLoadTexture = true;
		
		if(mP1.ix == Mesh.XPOS && mP1.iy == Mesh.YPOS && mP1.iz == Mesh.ZNEG) {//works
			this.addMeshPart(new MeshPartPlaneX(mFace1 , true, 2, -1, 1)); //
			this.addMeshPart(new MeshPartPlaneY(mFace2, true, 1, -1, 1)); //
			this.addMeshPart(new MeshPartPlaneZ(mFace3, false, 1 ,-1, 2)); //
			
		}
		else if (mP1.ix == Mesh.XPOS && mP1.iy == Mesh.YNEG && mP1.iz == Mesh.ZNEG)  {//works
			this.addMeshPart(new MeshPartPlaneX(mFace1 , true, 2, 1, 1)); 
			this.addMeshPart(new MeshPartPlaneY(mFace2, false, 1,2,1)); //
			this.addMeshPart(new MeshPartPlaneZ(mFace3, false, 1,1,2)); //
		}
		else if(mP1.ix == Mesh.XNEG && mP1.iy == Mesh.YNEG && mP1.iz == Mesh.ZNEG) { //works
			this.addMeshPart(new MeshPartPlaneX(mFace1 , false, -1, 1, 1)); //
			this.addMeshPart(new MeshPartPlaneY(mFace2, false, -1,2,1)); //
			this.addMeshPart(new MeshPartPlaneZ(mFace3, false, -1,1,2)); // 
			
		}
		else if (mP1.ix == Mesh.XNEG && mP1.iy == Mesh.YPOS && mP1.iz == Mesh.ZNEG)  {//works
			this.addMeshPart(new MeshPartPlaneX(mFace1 , false, -1, -1, 1)); //
			this.addMeshPart(new MeshPartPlaneY(mFace2, true, -1, -1, 1)); //
			this.addMeshPart(new MeshPartPlaneZ(mFace3, false, -1 ,-1, 2)); // 
		}
		//////////////////////////////////////////////////////////////
		else if(mP1.ix == Mesh.XPOS && mP1.iy == Mesh.YPOS && mP1.iz == Mesh.ZPOS) {// works
			this.addMeshPart(new MeshPartPlaneX(mFace1 , true, 2, -1, -1)); // 
			this.addMeshPart(new MeshPartPlaneY(mFace2, true, 1,-1,-1)); // 
			this.addMeshPart(new MeshPartPlaneZ(mFace3, true, 1,-1,-1)); // 
			
		}
		else if (mP1.ix == Mesh.XPOS && mP1.iy == Mesh.YNEG && mP1.iz == Mesh.ZPOS)  {/// works
			this.addMeshPart(new MeshPartPlaneX(mFace1 , true, 2, 1, -1)); // 
			this.addMeshPart(new MeshPartPlaneY(mFace2, false, 1, 2, -1)); // 
			this.addMeshPart(new MeshPartPlaneZ(mFace3, true, 1 ,1, -1)); // 
		}
		else if(mP1.ix == Mesh.XNEG && mP1.iy == Mesh.YNEG && mP1.iz == Mesh.ZPOS) { // works
			this.addMeshPart(new MeshPartPlaneX(mFace1 , false, -1, 1, -1)); // 
			this.addMeshPart(new MeshPartPlaneY(mFace2, false, -1,2,-1)); // 
			this.addMeshPart(new MeshPartPlaneZ(mFace3, true, -1,1,-1)); // 
			
		}
		else if (mP1.ix == Mesh.XNEG && mP1.iy == Mesh.YPOS && mP1.iz == Mesh.ZPOS)  {// works
			this.addMeshPart(new MeshPartPlaneX(mFace1 , false, -1, -1, -1)); // 
			this.addMeshPart(new MeshPartPlaneY(mFace2, true, -1, -1, -1)); // 
			this.addMeshPart(new MeshPartPlaneZ(mFace3, true, -1 ,-1, -1)); // 
		}
		
		this.mShouldLoadArrays = false;
	}
	
	
	
	
}

